# -*- coding: utf-8 -*-
'''
@文件    :__init__.py
@说明    :
@时间    :2025/08/25 15:43:06
@作者    :浪晋
@版本    :1.0
'''
import os
from flask import Flask


def create_app(env: str = "dev"):
    os.environ["FLASK_ENV"] = env   # 必须先加载环境变量,不然config无法正确加载
    from app.core import register
    from app.setting.config import config
    app = Flask(__name__)
    app.config.from_object(config)
    register.add_routes(app)
    register.add_hooks(app)
    register.add_exceptions(app)
    register.add_extensions(app)
    return app